
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>快速上手 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../bestpay/bestpay.html" />
    
    
    <link rel="prev" href="interfaces.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    项目介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../alipay/alipay.html">
            
                <a href="../alipay/alipay.html">
            
                    
                    支付宝支付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../alipay/params.html">
            
                <a href="../alipay/params.html">
            
                    
                    参数及配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../alipay/interfaces.html">
            
                <a href="../alipay/interfaces.html">
            
                    
                    接口列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../alipay/starter.html">
            
                <a href="../alipay/starter.html">
            
                    
                    快速上手
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="wechat.html">
            
                <a href="wechat.html">
            
                    
                    微信支付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="params.html">
            
                <a href="params.html">
            
                    
                    参数及配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="interfaces.html">
            
                <a href="interfaces.html">
            
                    
                    接口列表
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.3" data-path="starter.html">
            
                <a href="starter.html">
            
                    
                    快速上手
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../bestpay/bestpay.html">
            
                <a href="../bestpay/bestpay.html">
            
                    
                    翼支付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../bestpay/params.html">
            
                <a href="../bestpay/params.html">
            
                    
                    参数获取
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../bestpay/interfaces.html">
            
                <a href="../bestpay/interfaces.html">
            
                    
                    接口列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../bestpay/starter.html">
            
                <a href="../bestpay/starter.html">
            
                    
                    快速上手
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    示例项目
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <a target="_blank" href="https://gitee.com/thlws/payment-simple">
            
                    
                    https://gitee.com/thlws/payment-simple
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >快速上手</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5FEB;&#x901F;&#x4E0A;&#x624B;">&#x5FEB;&#x901F;&#x4E0A;&#x624B;</h1>
<h3 id="&#x5237;&#x5361;&#x652F;&#x4ED8;">&#x5237;&#x5361;&#x652F;&#x4ED8;</h3>
<p>&#x201C;&#x5237;&#x5361;&#x652F;&#x4ED8;&#x201D;&#x662F;&#x4ECE;&#x7528;&#x6237;&#x7684;&#x89D2;&#x5EA6;&#x5B9A;&#x4E49;&#xFF0C;&#x7528;&#x6237;&#x51FA;&#x793A;&#x5FAE;&#x4FE1;&#x4ED8;&#x6B3E;&#x7801;&#x7531;&#x5546;&#x5BB6;&#x626B;&#x7801;&#x5B8C;&#x6210;&#x652F;&#x4ED8;&#x52A8;&#x4F5C;&#xFF0C;&#x6B64;&#x60C5;&#x5883;&#x7C7B;&#x4F3C;&#x7528;&#x6237;&#x4F7F;&#x7528;&#x4FE1;&#x7528;&#x5361;&#x4ED8;&#x6B3E;&#xFF0C;&#x5FC5;&#x8981;&#x65F6;&#x9700;&#x7528;&#x6237;&#x8F93;&#x5165;&#x652F;&#x4ED8;&#x5BC6;&#x7801;&#x3002;</p>
<h4 id="&#x9002;&#x7528;&#x8303;&#x56F4;">&#x9002;&#x7528;&#x8303;&#x56F4;</h4>
<ul>
<li>&#x666E;&#x901A;&#x5546;&#x6237;</li>
<li>&#x5B50;&#x5546;&#x6237;</li>
<li><del>&#x5C0F;&#x5FAE;&#x652F;&#x4ED8;(&#x4E0D;&#x652F;&#x6301;)</del> </li>
</ul>
<h4 id="&#x8BF7;&#x6C42;&#x53C2;&#x6570;">&#x8BF7;&#x6C42;&#x53C2;&#x6570;</h4>
<ul>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61; <a href="https://gitee.com/thlws/payment-thl/tree/master/src/main/java/org/thlws/payment/wechat/entity/request/WechatPayRequest.java" target="_blank">org.thlws.payment.wechat.entity.request.WechatPayRequest</a></li>
<li>&#x5B98;&#x65B9;&#x8BF4;&#x660E; <a href="https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=9_10&amp;index=1" target="_blank">https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=9_10&amp;index=1</a><h4 id="&#x8FD4;&#x56DE;&#x53C2;&#x6570;">&#x8FD4;&#x56DE;&#x53C2;&#x6570;</h4>
</li>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61; <a href="https://gitee.com/thlws/payment-thl/tree/master/src/main/java/org/thlws/payment/wechat/entity/response/WechatPayResponse.java" target="_blank">org.thlws.payment.wechat.entity.response.WechatPayResponse</a></li>
<li>&#x5B98;&#x65B9;&#x8BF4;&#x660E; <a href="https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1#6" target="_blank">https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1#6</a><h4 id="&#x793A;&#x4F8B;&#x4EE3;&#x7801;">&#x793A;&#x4F8B;&#x4EE3;&#x7801;</h4>
</li>
</ul>
<pre><code>WechatPayRequest request = new WechatPayRequest();
request.setAppId(test_wechat_appid);
request.setMchId(test_wechat_mchid);

/*&#x666E;&#x901A;&#x6A21;&#x5F0F;&#x65E0;&#x9700;&#x8BBE;&#x7F6E;,&#x5B50;&#x5546;&#x6237;&#x9700;&#x8BBE;&#x7F6E;&#x5B50;&#x5546;&#x6237;&#x53F7;*/
//request.setSub_mch_id(sp_wechat_sub_mchid);

request.setSpbillCreateIp(NetUtil.getLocalhostStr());
request.setTotalFee(&quot;1&quot;);
request.setAttach(&quot;00001025104487&quot;);
request.setOutTradeNo(ThlwsBeanUtil.getRandomString(32));
request.setAuthCode(&quot;134593261103056527&quot;);
request.setDeviceInfo(&quot;device...&quot;);
request.setBody(&quot;pay test&quot;);

WechatPayResponse response = WechatPayClient.microPay(request,apiKey);
boolean flag = response.isSuccess();
String  message = response.getMessage();
</code></pre><h3 id="&#x626B;&#x7801;&#x652F;&#x4ED8;">&#x626B;&#x7801;&#x652F;&#x4ED8;</h3>
<p>&#x201C;&#x626B;&#x7801;&#x652F;&#x4ED8;&#x201D;&#x662F;&#x4ECE;&#x7528;&#x6237;&#x7684;&#x89D2;&#x5EA6;&#x5B9A;&#x4E49;&#xFF0C;&#x7528;&#x6237;&#x4F7F;&#x7528;&#x5FAE;&#x4FE1;&#x626B;&#x63CF;&#x201C;&#x4ED8;&#x6B3E;&#x7801;&#x201D;&#x5B8C;&#x6210;&#x652F;&#x4ED8;&#x52A8;&#x4F5C;&#xFF0C;&#x201C;&#x626B;&#x63CF;&#x652F;&#x4ED8;&#x201D;&#x5305;&#x542B;&#x4E24;&#x79CD;&#x6A21;&#x5F0F;&#xFF0C;&#x672C;&#x6587;&#x53EA;&#x9488;&#x5BF9;&#x300A;&#x6A21;&#x5F0F;&#x4E8C;&#x300B;&#x8FDB;&#x884C;&#x8BF4;&#x660E;&#xFF0C;&#x5FAE;&#x4FE1;&#x5B98;&#x65B9;&#x6A21;&#x5F0F;&#x8BF4;&#x660E;&#x8BF7;&#x53C2;&#x770B; <a href="https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=6_3#2" target="_blank">https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=6_3#2</a> &#x3002;</p>
<h4 id="&#x9002;&#x7528;&#x8303;&#x56F4;">&#x9002;&#x7528;&#x8303;&#x56F4;</h4>
<ul>
<li>&#x666E;&#x901A;&#x5546;&#x6237;</li>
<li>&#x5B50;&#x5546;&#x6237;</li>
<li>&#x5C0F;&#x5FAE;&#x652F;&#x4ED8;</li>
</ul>
<h4 id="&#x8BF7;&#x6C42;&#x53C2;&#x6570;">&#x8BF7;&#x6C42;&#x53C2;&#x6570;</h4>
<ul>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61; <a href="https://gitee.com/thlws/payment-thl/tree/master/src/main/java/org/thlws/payment/wechat/entity/request/UnifiedOrderRequest.java" target="_blank">org.thlws.payment.wechat.entity.request.UnifiedOrderRequest</a></li>
<li>&#x5B98;&#x65B9;&#x8BF4;&#x660E; <a href="https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1" target="_blank">https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1</a><h4 id="&#x8FD4;&#x56DE;&#x53C2;&#x6570;">&#x8FD4;&#x56DE;&#x53C2;&#x6570;</h4>
</li>
<li>&#x53C2;&#x6570;&#x5BF9;&#x8C61; <a href="https://gitee.com/thlws/payment-thl/tree/master/src/main/java/org/thlws/payment/wechat/entity/response/UnifiedOrderResponse.java" target="_blank">org.thlws.payment.wechat.entity.response.UnifiedOrderResponse</a></li>
<li>&#x5B98;&#x65B9;&#x8BF4;&#x660E; <a href="https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1" target="_blank">https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1</a></li>
</ul>
<h4 id="&#x793A;&#x4F8B;&#x4EE3;&#x7801;">&#x793A;&#x4F8B;&#x4EE3;&#x7801;</h4>
<pre><code class="lang-java">
UnifiedOrderRequest request = <span class="hljs-keyword">new</span> UnifiedOrderRequest();
request.setAppId(test_wechat_appid);
request.setMchId(test_wechat_mchid);

<span class="hljs-comment">/*&#x666E;&#x901A;&#x6A21;&#x5F0F;&#x65E0;&#x9700;&#x8BBE;&#x7F6E;,&#x5B50;&#x5546;&#x6237;&#x9700;&#x8BBE;&#x7F6E;&#x5B50;&#x5546;&#x6237;&#x53F7;,&#x5C0F;&#x5FAE;&#x6A21;&#x5F0F;&#x56FA;&#x5B9A;&#x586B;1000077001*/</span>
<span class="hljs-comment">//request.setSub_mch_id(&quot;1396726602&quot;);</span>

 <span class="hljs-comment">/*open_id &#x4E0E; sub_openid &#x62E9;&#x5176;&#x4E00;&#x5373;&#x53EF;,&#x5177;&#x4F53;&#x4F20;&#x503C;&#x65B9;&#x5F0F;&#x4EE5;&#x53C2;&#x6570;&#x8BF4;&#x660E;&#x4E3A;&#x51C6;*/</span>
<span class="hljs-comment">//request.setOpenid(&quot;&#x7528;&#x6237;&#x5728;appid&#x4E0B;&#x7528;&#x6237;&#x6807;&#x8BC6;&quot;);</span>

<span class="hljs-comment">/*open_id &#x4E0E; sub_openid &#x62E9;&#x5176;&#x4E00;&#x5373;&#x53EF;,&#x5177;&#x4F53;&#x4F20;&#x503C;&#x65B9;&#x5F0F;&#x4EE5;&#x53C2;&#x6570;&#x8BF4;&#x660E;&#x4E3A;&#x51C6;*/</span>
<span class="hljs-comment">//request.setSub_openid(&quot;&#x7528;&#x6237;&#x5728;sub_appid&#x4E0B;&#x7528;&#x6237;&#x6807;&#x8BC6;&quot;);</span>
String body = <span class="hljs-string">&quot;&#x52A8;&#x6001;&#x4E8C;&#x7EF4;&#x7801;&#x652F;&#x4ED8;&#x6D4B;&#x8BD5;&quot;</span>;
request.setBody(body);
request.setOutTradeNo(System.currentTimeMillis()+<span class="hljs-string">&quot;&quot;</span>);
request.setTotalFee(<span class="hljs-string">&quot;1&quot;</span>);
request.setTradeType(<span class="hljs-string">&quot;NATIVE&quot;</span>);
request.setNotifyUrl(<span class="hljs-string">&quot;http://www.thlws.com/notify4Wechat.html&quot;</span>);
request.setSpbillCreateIp(NetUtil.getLocalhostStr());

UnifiedOrderResponse response = WechatPayClient.unifiedOrder(request,test_wechat_apikey);
<span class="hljs-keyword">boolean</span> flag = response.isSuccess();
String  message = response.getMessage();
log.debug(<span class="hljs-string">&quot;isSuccess=&quot;</span>+flag+<span class="hljs-string">&quot;, message=&quot;</span>+message);
String qrcode = response.getCodeUrl();
assertNotNull(qrcode);

<span class="hljs-comment">//&#x751F;&#x6210;&#x652F;&#x4ED8;&#x4E8C;&#x7EF4;&#x7801;&#xFF0C;&#x4F9B;&#x7528;&#x6237;&#x626B;&#x7801;&#x652F;&#x4ED8;</span>
<span class="hljs-comment">//ZxingUtil.qrCode(qrcode,&quot;png&quot;,&quot;/zone/qrcode/&quot;+request.getOut_trade_no()+&quot;.png&quot;);</span>
<span class="hljs-comment">//TODO &#x8C03;&#x7528;&#x67E5;&#x8BE2;&#x63A5;&#x53E3;&#xFF0C;&#x68C0;&#x6D4B;&#x7528;&#x6237;&#x662F;&#x5426;&#x5B8C;&#x6210;&#x652F;&#x4ED8;,&#x6216;&#x8005;&#x57FA;&#x4E8E;&#x5FAE;&#x4FE1; &#x5F02;&#x6B65;&#x8FD4;&#x56DE;(notify_url) &#x68C0;&#x6D4B;&#x662F;&#x5426;&#x5B8C;&#x6210;&#x652F;&#x4ED8;</span>
</code></pre>
<h3 id="&#x516C;&#x4F17;&#x53F7;&#x652F;&#x4ED8;">&#x516C;&#x4F17;&#x53F7;&#x652F;&#x4ED8;</h3>
<p>&#x201C;&#x516C;&#x4F17;&#x53F7;&#x652F;&#x4ED8;&#x201D;&#x662F;&#x6307;&#x7528;&#x6237;&#x5728;&#x5FAE;&#x4FE1;H5&#x4E2D;&#x8C03;&#x7528;&#x5FAE;&#x4FE1;&#x5B8C;&#x6210;&#x652F;&#x4ED8;&#x7684;&#x52A8;&#x4F5C;&#xFF0C;&#x4E0E;&#x201C;&#x626B;&#x7801;&#x652F;&#x4ED8;&#x201D;&#x7C7B;&#x4F3C;&#x5747;&#x9700;&#x8C03;&#x7528;&#x7EDF;&#x4E00;&#x4E0B;&#x5355;&#x63A5;&#x53E3;&#x3002;</p>
<h4 id="&#x9002;&#x7528;&#x8303;&#x56F4;">&#x9002;&#x7528;&#x8303;&#x56F4;</h4>
<ul>
<li>&#x666E;&#x901A;&#x5546;&#x6237;</li>
<li>&#x5B50;&#x5546;&#x6237;</li>
<li>&#x5C0F;&#x5FAE;&#x652F;&#x4ED8;</li>
</ul>
<h4 id="&#x524D;&#x7F6E;&#x6761;&#x4EF6;">&#x524D;&#x7F6E;&#x6761;&#x4EF6;</h4>
<p>&#x5FC5;&#x987B;&#x53D6;&#x5F97;&#x7528;&#x6237;OpenId&#xFF08;&#x900F;&#x8FC7;code&#x6216;&#x5176;&#x4ED6;&#x65B9;&#x5F0F;&#x652F;&#x4ED8;&#x540E;&#x8FD4;&#x56DE;openid&#xFF09;</p>
<p>1.&#x751F;&#x6210;&#x7528;&#x4E8E;&#x83B7;&#x53D6;code&#x7684;&#x5FAE;&#x4FE1;&#x89C4;&#x5219;URL</p>
<pre><code class="lang-java">String appId = <span class="hljs-string">&quot;wx5f22a16d8c94dba4&quot;</span>;
String scope = <span class="hljs-string">&quot;snsapi_base&quot;</span>;
String callback = <span class="hljs-string">&quot;http://www.thlws.com/wechat/callback/getcode.html&quot;</span>;
String bizData = <span class="hljs-string">&quot;&quot;</span>;<span class="hljs-comment">//&#x5BF9;&#x5E94;&#x5FAE;&#x4FE1;state&#x53C2;&#x6570;&#xFF0C;&#x5FAE;&#x4FE1;&#x4F1A;&#x539F;&#x6837;&#x8FD4;&#x56DE;</span>
String url = WechatMpClient.generateWechatUrl(appId, scope, callback, bizData);
</code></pre>
<p>2.&#x5904;&#x7406;&#x5982;&#x4E0A;callback&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x83B7;&#x53D6;code</p>
<pre><code class="lang-java">String code = request.getParameter(<span class="hljs-string">&quot;code&quot;</span>);
</code></pre>
<p>3.&#x6839;&#x636E;code&#x83B7;&#x53D6;&#x7528;&#x6237;openid</p>
<pre><code class="lang-java">Map&lt;String, Object&gt; mapToken = <span class="hljs-keyword">new</span> HashMap&lt;String, Object&gt;();
String appId = <span class="hljs-string">&quot;wx5f22a16d8c94dba4&quot;</span>;
String appSecret = <span class="hljs-string">&quot;d24a3e612fca66ae28137de28916f875&quot;</span>;
String code = <span class="hljs-string">&quot;11111&quot;</span>;
mapToken.put(<span class="hljs-string">&quot;appid&quot;</span>, appId);
mapToken.put(<span class="hljs-string">&quot;secret&quot;</span>, appSecret);
mapToken.put(<span class="hljs-string">&quot;code&quot;</span>, code);
mapToken.put(<span class="hljs-string">&quot;grant_type&quot;</span>, <span class="hljs-string">&quot;authorization_code&quot;</span>);
OauthTokenResponse response = WechatMpClient.obtainOauthAccessToken(mapToken);
System.out.println(<span class="hljs-string">&quot;openid=&quot;</span>+response.getOpenid());
</code></pre>
<h4 id="&#x652F;&#x4ED8;&#x6D41;&#x7A0B;">&#x652F;&#x4ED8;&#x6D41;&#x7A0B;</h4>
<ul>
<li>&#x8C03;&#x7528;&#x9884;&#x8BA2;&#x5355;&#x63A5;&#x53E3;&#xFF08;&#x540C;&#x626B;&#x7801;&#x652F;&#x4ED8;,&#x6CE8;&#x610F;tradeType=&quot;JSAPI&quot;&#xFF09;</li>
<li>&#x9884;&#x8BA2;&#x5355;&#x7ED3;&#x679C;&#x6570;&#x636E;&#x8FD4;&#x56DE;&#x524D;&#x53F0;JSP&#x9875;&#x9762;&#xFF0C;&#x8C03;&#x7528;&#x5FAE;&#x4FE1;JSAPI&#x5B8C;&#x6210;&#x652F;&#x4ED8;.</li>
</ul>
<h4 id="&#x793A;&#x4F8B;&#x4EE3;&#x7801;">&#x793A;&#x4F8B;&#x4EE3;&#x7801;</h4>
<pre><code class="lang-jsp">&lt;%@ taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;%&gt;
&lt;%@ taglib prefix=&quot;fmt&quot; uri=&quot;http://java.sun.com/jsp/jstl/fmt&quot;%&gt;
&lt;%@ taglib prefix=&quot;fn&quot; uri=&quot;http://java.sun.com/jsp/jstl/functions&quot;%&gt;
&lt;%@ page language=&quot;java&quot; import=&quot;java.util.*&quot; pageEncoding=&quot;UTF-8&quot;
    trimDirectiveWhitespaces=&quot;true&quot;%&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; style=&quot;overflow:auto&quot; dir=&quot;ltr&quot; class=&quot;uk-notouch&quot;&gt;

&lt;!-- &#x516C;&#x8D26;&#x53F7;&#x652F;&#x4ED8;&#x793A;&#x4F8B;JSP --&gt;

&lt;script type=&quot;text/javascript&quot;&gt;

    function onBridgeReady() {
        WeixinJSBridge.invoke(&apos;getBrandWCPayRequest&apos;, {
            &quot;appId&quot; : &apos;${appId}&apos;,
            &quot;timeStamp&quot; : &apos;${timeStamp}&apos;,   
            &quot;nonceStr&quot; : &apos;${nonceStr}&apos;,
            &quot;package&quot; : &apos;${packageStr}&apos;,
            &quot;signType&quot; : &apos;${signType}&apos;,   
            &quot;paySign&quot; :  &apos;${paySign}&apos;
        }, function(res) {
            if (res.err_msg == &quot;get_brand_wcpay_request:ok&quot;) {

                setTimeout(pay_ok,1500);//&#x652F;&#x4ED8;&#x6210;&#x529F;&#x5E76;&#x8FDB;&#x884C;&#x9875;&#x9762;&#x8DF3;&#x8F6C;

            }else{

                if(res.err_msg == &quot;get_brand_wcpay_request:cancel&quot;){
                    //&#x652F;&#x4ED8;&#x88AB;&#x53D6;&#x6D88; FIXME
                }else{
                    //&#x5176;&#x4ED6;&#x5F02;&#x5E38;&#x5F39;&#x51FA;&#x5BF9;&#x5E94;&#x5F02;&#x5E38;&#x4FE1;&#x606F; FIXME
                }
                setTimeout(pay_ng,1500);
            }
        });
    }


    if (typeof WeixinJSBridge == &quot;undefined&quot;) {
        if (document.addEventListener) {
            document.addEventListener(&apos;WeixinJSBridgeReady&apos;,onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent(&apos;WeixinJSBridgeReady&apos;, onBridgeReady);
            document.attachEvent(&apos;onWeixinJSBridgeReady&apos;, onBridgeReady);
        }
    } else {
        onBridgeReady();
    }


    function retry(){
        window.location.reload();
    }


    /*&#x652F;&#x4ED8;&#x6210;&#x529F;*/
    function pay_ok() {
        //&#x8DDF;&#x8FDB;&#x81EA;&#x5DF1;&#x4E1A;&#x52A1;&#x51B3;&#x5B9A;&#x8DF3;&#x8F6C;&#x9875;&#x9762;,pay_ok.html&#x4EC5;&#x4E3A;&#x793A;&#x4F8B;URL
        window.location.href=&quot;${pageContext.request.contextPath}/pay_ok.html&quot;;
    }

    /*&#x652F;&#x4ED8;&#x5931;&#x8D25;*/
    function pay_ng() {
        //&#x8DDF;&#x8FDB;&#x81EA;&#x5DF1;&#x4E1A;&#x52A1;&#x51B3;&#x5B9A;&#x8DF3;&#x8F6C;&#x9875;&#x9762;,pay_ng.html&#x4EC5;&#x4E3A;&#x793A;&#x4F8B;URL
        window.location.href=&quot;${pageContext.request.contextPath}/pay_ng.html&quot;;
    }

&lt;/script&gt;
&lt;head&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<h2 id="&#x529F;&#x80FD;&#x6D4B;&#x8BD5;">&#x529F;&#x80FD;&#x6D4B;&#x8BD5;</h2>
<ul>
<li><a href="https://gitee.com/thlws/payment-thl/tree/master/src/test/java/org/thlws/payment/wechat/WechatPayClientTest.java" target="_blank">org.thlws.payment.wechat.WechatPayClientTest</a></li>
<li><a href="https://gitee.com/thlws/payment-thl/tree/master/src/test/java/org/thlws/payment/wechat/WechatMpClientTest.java" target="_blank">org.thlws.payment.wechat.WechatMpClientTest</a></li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="interfaces.html" class="navigation navigation-prev " aria-label="Previous page: 接口列表">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../bestpay/bestpay.html" class="navigation navigation-next " aria-label="Next page: 翼支付">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"快速上手","level":"1.3.3","depth":2,"next":{"title":"翼支付","level":"1.4","depth":1,"path":"bestpay/bestpay.md","ref":"bestpay/bestpay.md","articles":[{"title":"参数获取","level":"1.4.1","depth":2,"path":"bestpay/params.md","ref":"bestpay/params.md","articles":[]},{"title":"接口列表","level":"1.4.2","depth":2,"path":"bestpay/interfaces.md","ref":"bestpay/interfaces.md","articles":[]},{"title":"快速上手","level":"1.4.3","depth":2,"path":"bestpay/starter.md","ref":"bestpay/starter.md","articles":[]}]},"previous":{"title":"接口列表","level":"1.3.2","depth":2,"path":"wechat/interfaces.md","ref":"wechat/interfaces.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"wechat/starter.md","mtime":"2018-12-02T08:44:28.919Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-25T13:36:22.351Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

